@extends('default.layouts.adminPublic')
@section('title', '企业认证审核')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/admin/indexList.css')}}">
    @endsection
    @section('content')
            <!--导航开始-->
    <div class="crumb_warp">
        <i class="fa fa-home"></i> <a href="{{url('admin/audit_post')}}">首页</a> &raquo; 企业认证审核
    </div>
    <!--导航结束-->
    <!--结果集标题与导航组件 开始-->

    <div class="con">
        <div class="conMain">
            <div class="result_wrap">
                <div class="search">
                    <form name="Formso" id="Formso" action="{{url('admin/com_check')}}" method="post">
                        {{csrf_field()}}
                        <span>关键字：</span>
                        <span><input name="company_name" class="keyword" id="company_name" placeholder="请输入公司名称"
                                     type="text"></span>
                        <select name="status" id="status">
                            <option value="">不限</option>
                            <option value="0">未审核</option>
                            <option value="1">审核通过</option>
                            <option value="2">审核不通过</option>
                        </select>
                        <span><input name="submit" class="skeyword" value="搜索" type="submit"></span>
                    </form>
                </div>
                <div class="message"><p>
                        目前共查找到<strong>{{$companyCertification->total()}}</strong>个企业认证！且每页显示条数为{{$companyCertification->perPage()}}
                        条。</p></div>
            </div>
            <div class="manage">
                @include('flash::message')
            </div>
            <div class="conInfo">
                <form name="thisForm" id="thisForm" action="" method="post">
                    {{csrf_field()}}
                    <div class="conList" id="conList">
                        <dl class="one">
                            <dt><input name="selectall" type="checkbox" value="1" onclick="CheckAll(this)"/></dt>
                            <dd class="license1">公司名称</dd>
                            <dd class="license2">营业执照</dd>
                            <dd class="license3">审核状态</dd>
                            <dd class="license4">更新时间</dd>
                            <dd class="license5">认证操作</dd>
                        </dl>
                        @if($companyCertification->count() > 0 )
                            @foreach($companyCertification as $v)
                                <dl id="list{{$v->id}}">
                                    <dt><input name="selected_id[]" type="checkbox" value="{{$v->id}}"/></dt>
                                    @if($v->viptime>date('Y-m-d,H:i:s',time()))
                                        <dd class="license1">
                                            <a  href="{{url('comabout_'.idEncryption($v->com_id).'.html')}}" target="_blank">{{str_limit($v->company_name,28)}}</a>
                                            <b style="color: #f43838">vip</b>
                                        </dd>
                                    @else
                                        <dd class="license1">
                                            <a   href="{{url('comabout_'.idEncryption($v->com_id).'.html')}}" target="_blank">{{str_limit($v->company_name,28)}}</a>
                                        </dd>
                                    @endif
                                    <dd class="license2"><a href="{{asset('/upload/companylicense/'.$v->license)}}"
                                                            target="_blank">{{str_limit($v->license,28)}}</a></dd>
                                    <dd class="license3">
                                        @if($v->status == '0')
                                            <span>未审核</span>
                                        @elseif($v->status == '1')
                                            <span style="color:#2f8e2d">审核通过</span>
                                        @elseif($v->status == '2')
                                            <span style="color:#ff4400">审核不通过</span>
                                        @endif
                                    </dd>
                                    <dd class="license4">{{$v->updated_at}}</dd>
                                    <dd class="license5">
                                        <span><a href="{{url('admin/pass_check?id='.$v->id)}}">通过审核</a></span>
                                        <span class="fail"><a>审核不通过</a></span>
                                        <span class="del"><a>删除企业</a></span>
                                    </dd>
                                </dl>
                            @endforeach
                        @else
                            <div class="nullcon">对不起！没有符合条件的记录！</div>
                        @endif
                        <dl class="last">
                            <dt>
                                <input name="selectall" id="selectall" type="checkbox" value="1"
                                       onclick="CheckAll(this)"/>
                                <label for="selectall">全选</label>
                            </dt>
                            <dd class="p6"><a onclick="showconfirm('{{url('admin/pass_batch_check')}}','2')">批量审核</a>
                            </dd>
                            <dd class="p6"><a onclick="showconfirm('{{url('admin/del_batch')}}','1')">批量删除</a></dd>
                        </dl>
                    </div>
                </form>
                <div class="page_list" style="width: 100%; float: left; margin-top:15px;">
                    {!! $companyCertification->appends($appends)->links() !!}
                </div>
            </div>

            <div class="stopper" style="margin-top:10px; border-top: 1px solid #e5e5e5"></div>
        </div>
    </div>
    <!--结果集标题与导航组件 结束-->
@endsection

@section('footerjs')
    @parent
    <script>
        $(function(){
            $("#status").val('{{$status}}');
            //删除当前
            @if($companyCertification->count() > 0 )
                @foreach($companyCertification as $v)
                $('#conList').find("#list" + '{{$v->id}}').find('.fail a').click(function(){
                layer.open({
                    title: '您确定这个企业不通过吗?',
                    area: ['400px', '240px'],
                    content: '<textarea name="remark" style="width:340px;" cols="2" rows="3" id="remark" placeholder="请输入原因"' +
                    ' type="text">{{$v->remark}}</textarea><span style="color:#ff4400;" class="error"></span>',
                    btn: ['确定', '取消'],
                    yes: function(){
                        if(str_trim($("#remark").val()) == ''){
                            $('.error').html('审核不通过的原因必须填写');
                            return false;
                        }else{

                            layer.closeAll();
                            $.post("/admin/fail_check",
                                    {
                                        'id': '{{$v->id}}',
                                        'remark': str_trim($("#remark").val()),
                                        '_token': "{{csrf_token()}}"
                                    },
                                    function(data){
                                        if(data.status == 0){
                                            layer.msg(data.msg, {time: 1500});
                                        }else{
                                            layer.msg(data.msg, {time: 1500});
                                        }
                                        location = '{{$curr_url}}';
                                    });
                        }
                    }
                });
            });

            $('#conList').find("#list" + '{{$v->id}}').find('.del a').click(function(){
                layer.confirm('您确定要删除这个企业认证吗？', {
                    btn: ['确定', '取消'] //按钮
                }, function(){
                    $.post("/admin/del", {'id': '{{$v->id}}', '_token': "{{csrf_token()}}"}, function(data){
                        if(data.status == 0){
                            layer.msg(data.msg, {icon: 6, time: 1500});
                        }else{
                            layer.msg(data.msg, {icon: 5, time: 1500});
                        }
                        location = '{{$curr_url}}';
                    });
                });
            });
            @endforeach
            @endif
        });
    </script>
    <script type="text/javascript" src="{{asset('/default/js/admin/resumeList.js')}}"></script>
@endsection